package com.hxkj.client.service;

import com.hxkj.domain.po.AllocationFunction;
import com.hxkj.domain.po.AuthRole;
import com.platform.common.domain.result.ParameterDataStruct;
import com.platform.common.domain.result.ResultDataStruct;
import com.platform.common.domain.result.ResultMessageStruct;
import com.platform.common.domain.result.ResultPageStruct;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


/**
 * @author chenfangzhou
 * @create 2018-05-23 11:58
 * @desc 角色对外接口
 **/
@FeignClient(name = "cms-management")
public interface AuthRoleServiceClient {
    /**
     * 获取角色列表
     *
     * @param parameterDataStruct 角色列表
     * @return 翻页数据
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/getlist", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultPageStruct<AuthRole> getRoleList(@RequestBody ParameterDataStruct<AuthRole> parameterDataStruct) throws Exception;


    /**
     * 从slave服务器获取角色列表
     *
     * @param parameterDataStruct 从从库获取角色列表
     * @return 翻页数据
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/getlist/slave", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultPageStruct<AuthRole> getUserBySlave(@RequestBody ParameterDataStruct<AuthRole> parameterDataStruct) throws Exception;


    /**
     * 获取单个角色
     *
     * @param authRole
     * @return 角色
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/get", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultDataStruct<AuthRole> getAuthRole(@RequestBody AuthRole authRole) throws Exception;


    /**
     * 新增角色
     *
     * @param authRole 角色信息
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/save", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultMessageStruct saveAuthRole(@RequestBody AuthRole authRole) throws Exception;


    /**
     * 删除角色
     *
     * @param authRole 角色信息
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/remove", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultMessageStruct deleteAuthRole(@RequestBody AuthRole authRole) throws Exception;


    /**
     * 更新角色
     *
     * @param authRole 角色信息
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/modify", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultMessageStruct updateAuthRole(@RequestBody AuthRole authRole) throws Exception;


    /**
     * 获取该角色已分配的功能/全部功能
     *
     * @param authRole 角色
     * @return 已分配的功能/全部功能
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/getfunction", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultDataStruct<AllocationFunction> getFunction(@RequestBody AuthRole authRole) throws Exception;

    /**
     * 获取该角色已分配的功能/全部功能
     *
     * @param authRole 角色
     * @return 已分配的功能/全部功能
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/getfunctions", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultDataStruct<AllocationFunction> getFunctions(@RequestBody AuthRole authRole) throws Exception;

    /**
     * 为该角色分配功能
     *
     * @param authRole 角色
     * @return 已分配的功能/全部功能
     * @throws Exception
     */
    @RequestMapping(value = "/authrole/setfunction", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultMessageStruct allocationFunction(@RequestBody AuthRole authRole)
            throws Exception;


}
